top.learun = (function ($) {
    var learun = {
        isDebug: true, log: function () {
            if (learun.isDebug) {
                console.log("=====>" + new Date().getTime() + "<=====");
                var len = arguments.length;
                for (var i = 0; i < len; i++) {
                    console.log(arguments[i])
                }
            }
        }, newGuid: function () {
            var guid = "";
            for (var i = 1; i <= 32; i++) {
                var n = Math.floor(Math.random() * 16).toString(16);
                guid += n;
                if ((i == 8) || (i == 12) || (i == 16) || (i == 20)) {
                    guid += "-"
                }
            }
            return guid
        }, loading: function (isShow, text) {
            var $loading = top.$("#lr_loading_bar");
            if (!!text) {
                top.$("#lr_loading_bar_message").html(text)
            } else {
                top.$("#lr_loading_bar_message").html("正在拼了命为您加载…")
            }
            if (isShow) {
                $loading.show()
            } else {
                $loading.hide()
            }
        }, loadStyles: function (url) {
            var link = document.createElement("link");
            link.type = "text/css";
            link.rel = "stylesheet";
            link.href = url;
            document.getElementsByTagName("head")[0].appendChild(link)
        }, iframe: function (Id, _frames) {
            if (_frames[Id] != undefined) {
                if (_frames[Id].contentWindow != undefined) {
                    return _frames[Id].contentWindow
                } else {
                    return _frames[Id]
                }
            } else {
                return null
            }
        }, changeUrlParam: function (url, key, value) {
            var newUrl = "";
            var reg = new RegExp("(^|)" + key + "=([^&]*)(|$)");
            var tmp = key + "=" + value;
            if (url.match(reg) != null) {
                newUrl = url.replace(eval(reg), tmp)
            } else {
                if (url.match("[?]")) {
                    newUrl = url + "&" + tmp
                } else {
                    newUrl = url + "?" + tmp
                }
            }
            return newUrl
        }, toDecimal: function (num) {
            if (num == null) {
                num = "0"
            }
            num = num.toString().replace(/\$|\,/g, "");
            if (isNaN(num)) {
                num = "0"
            }
            var sign = (num == (num = Math.abs(num)));
            num = Math.floor(num * 100 + 0.50000000001);
            var cents = num % 100;
            num = Math.floor(num / 100).toString();
            if (cents < 10) {
                cents = "0" + cents
            }
            for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
                num = num.substring(0, num.length - (4 * i + 3)) + "" + num.substring(num.length - (4 * i + 3))
            }
            return (((sign) ? "" : "-") + num + "." + cents)
        }, countFileSize: function (size) {
            if (size < 1024) {
                return learun.toDecimal(size) + " 字节"
            } else {
                if (size >= 1024 && size < 1048576) {
                    return learun.toDecimal(size / 1024) + " KB"
                } else {
                    if (size >= 1048576 && size < 1073741824) {
                        return learun.toDecimal(size / 1024 / 1024) + " MB"
                    } else {
                        if (size >= 1073741824) {
                            return learun.toDecimal(size / 1024 / 1024 / 1024) + " GB"
                        }
                    }
                }
            }
        }, arrayCopy: function (data) {
            return $.map(data, function (obj) {
                return $.extend(true, {}, obj)
            })
        }, checkrow: function (id) {
            var isOK = true;
            if (id == undefined || id == "" || id == "null" || id == "undefined") {
                isOK = false;
                learun.alert.warning("您没有选中任何数据项,请选中后再操作！")
            }
            return isOK
        }, alert: {
            success: function (msg) {
                toastr.success(msg)
            }, info: function (msg) {
                toastr.info(msg)
            }, warning: function (msg) {
                toastr.warning(msg)
            }, error: function (msg) {
                toastr.error(msg)
            }
        }, download: function (options) {
            var defaults = {method: "GET", url: "", param: []};
            var options = $.extend(defaults, options);
            if (options.url && options.param) {
                var $form = $('<form action="' + options.url + '" method="' + (options.method || "post") + '"></form>');
                for (var key in options.param) {
                    var $input = $('<input type="hidden" />').attr("name", key).val(options.param[key]);
                    $form.append($input)
                }
                $form.appendTo("body").submit().remove()
            }
        }, commafy: function (num) {
            if (num == null) {
                num = "0"
            }
            if (isNaN(num)) {
                return "0"
            }
            num = num + "";
            if (/^.*\..*$/.test(num)) {
                varpointIndex = num.lastIndexOf(".");
                varintPart = num.substring(0, pointIndex);
                varpointPart = num.substring(pointIndex + 1, num.length);
                intPart = intPart + "";
                var re = /(-?\d+)(\d{3})/;
                while (re.test(intPart)) {
                    intPart = intPart.replace(re, "$1,$2")
                }
                num = intPart + "." + pointPart
            } else {
                num = num + "";
                var re = /(-?\d+)(\d{3})/;
                while (re.test(num)) {
                    num = num.replace(re, "$1,$2")
                }
            }
            return num
        }, isExistImg: function (pathImg) {
            if (!!pathImg) {
                var ImgObj = new Image();
                ImgObj.src = pathImg;
                if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
                    return true
                } else {
                    return false
                }
            } else {
                return false
            }
        }
    };
    return learun
})(window.jQuery);
(function (a, c) {
    var b = {};
    c.frameTab = {
        iframeId: "", init: function () {
            c.frameTab.bind()
        }, bind: function () {
            a(".lr-frame-tabs-wrap").mCustomScrollbar({axis: "x", theme: "minimal-dark"})
        }, setCurrentIframeId: function (d) {
            c.iframeId = d
        }, open: function (h, i) {
            var g = a("#lr_frame_tabs_ul");
            var d = a("#lr_frame_main");
            if (b[h.F_ModuleId] == undefined || b[h.F_ModuleId] == null) {
                if (c.frameTab.iframeId != "") {
                    g.find("#lr_tab_" + c.frameTab.iframeId).removeClass("active");
                    d.find("#lr_iframe_" + c.frameTab.iframeId).removeClass("active");
                    b[c.frameTab.iframeId] = 0
                }
                var j = c.frameTab.iframeId;
                c.frameTab.iframeId = h.F_ModuleId;
                b[c.frameTab.iframeId] = 1;
                var f = a('<li class="lr-frame-tabItem active" id="lr_tab_' + h.F_ModuleId + '" parent-id="' + j + '"  ><span><i class="' + h.F_Icon + '"></i>&nbsp;' + h.F_FullName + "</span></li>");
                if (!i) {
                    f.append('<span class="reomve" title="关闭窗口"></span>')
                }
                var e = a('<iframe class="lr-frame-iframe active" id="lr_iframe_' + h.F_ModuleId + '" frameborder="0" src="' + a.rootUrl + h.F_UrlAddress + '"></iframe>');
                g.append(f);
                d.append(e);
                a(".lr-frame-tabs-wrap").mCustomScrollbar("update");
                a(".lr-frame-tabs-wrap").mCustomScrollbar("scrollTo", f);
                f.on("click", function () {
                    var k = a(this).attr("id").replace("lr_tab_", "");
                    c.frameTab.focus(k)
                });
                f.find(".reomve").on("click", function () {
                    var k = a(this).parent().attr("id").replace("lr_tab_", "");
                    c.frameTab.close(k);
                    return false
                });
                if (!!c.frameTab.opencallback) {
                    c.frameTab.opencallback()
                }
                if (!i) {
                    a.ajax({
                        url: top.$.rootUrl + "/Home/VisitModule",
                        data: {moduleName: h.F_FullName, moduleUrl: h.F_UrlAddress},
                        type: "post",
                        dataType: "text"
                    })
                }
            } else {
                c.frameTab.focus(h.F_ModuleId)
            }
        }, focus: function (d) {
            if (b[d] == 0) {
                a("#lr_tab_" + c.frameTab.iframeId).removeClass("active");
                a("#lr_iframe_" + c.frameTab.iframeId).removeClass("active");
                b[c.frameTab.iframeId] = 0;
                a("#lr_tab_" + d).addClass("active");
                a("#lr_iframe_" + d).addClass("active");
                c.frameTab.iframeId = d;
                b[d] = 1;
                a(".lr-frame-tabs-wrap").mCustomScrollbar("scrollTo", a("#lr_tab_" + d));
                if (!!c.frameTab.opencallback) {
                    c.frameTab.opencallback()
                }
            }
        }, leaveFocus: function () {
            a("#lr_tab_" + c.frameTab.iframeId).removeClass("active");
            a("#lr_iframe_" + c.frameTab.iframeId).removeClass("active");
            b[c.frameTab.iframeId] = 0;
            c.frameTab.iframeId = ""
        }, close: function (f) {
            delete b[f];
            var e = a("#lr_tab_" + f);
            var d = e.prev();
            if (d.length < 1) {
                d = e.next()
            }
            e.remove();
            a("#lr_iframe_" + f).remove();
            if (f == c.frameTab.iframeId && d.length > 0) {
                var g = d.attr("id").replace("lr_tab_", "");
                d.addClass("active");
                a("#lr_iframe_" + g).addClass("active");
                c.frameTab.iframeId = g;
                b[g] = 1;
                a(".lr-frame-tabs").css("width", "10000px");
                a(".lr-frame-tabs-wrap").mCustomScrollbar("update");
                a(".lr-frame-tabs").css("width", "100%");
                a(".lr-frame-tabs-wrap").mCustomScrollbar("scrollTo", d)
            } else {
                if (d.length < 1) {
                    c.frameTab.iframeId = ""
                }
                a(".lr-frame-tabs").css("width", "10000px");
                a(".lr-frame-tabs-wrap").mCustomScrollbar("update");
                a(".lr-frame-tabs").css("width", "100%")
            }
            if (!!c.frameTab.closecallback) {
                c.frameTab.closecallback()
            }
        }, currentIframe: function () {
            var d = "lr_iframe_" + c.frameTab.iframeId;
            if (top.frames[d].contentWindow != undefined) {
                return top.frames[d].contentWindow
            } else {
                return top.frames[d]
            }
        }, parentIframe: function () {
            var d = "lr_iframe_" + top.$("#lr_tab_" + c.frameTab.iframeId).attr("parent-id");
            if (top.frames[d].contentWindow != undefined) {
                return top.frames[d].contentWindow
            } else {
                return top.frames[d]
            }
        }, opencallback: false, closecallback: false
    };
    c.frameTab.init()
})(window.jQuery, top.learun);
(function (a, b) {
    a.extend(b, {
        parseDate: function (d) {
            var c;
            if (d.indexOf("/Date(") > -1) {
                c = new Date(parseInt(d.replace("/Date(", "").replace(")/", ""), 10))
            } else {
                c = new Date(Date.parse(d.replace(/-/g, "/").replace("T", " ").split(".")[0]))
            }
            return c
        }, formatDate: function (h, e) {
            if (!h) {
                return ""
            }
            var c = h;
            if (typeof h === "string") {
                if (h.indexOf("/Date(") > -1) {
                    c = new Date(parseInt(h.replace("/Date(", "").replace(")/", ""), 10))
                } else {
                    c = new Date(Date.parse(h.replace(/-/g, "/").replace("T", " ").split(".")[0]))
                }
            }
            var g = {
                "M+": c.getMonth() + 1,
                "d+": c.getDate(),
                "h+": c.getHours(),
                "m+": c.getMinutes(),
                "s+": c.getSeconds(),
                "q+": Math.floor((c.getMonth() + 3) / 3),
                S: c.getMilliseconds()
            };
            if (/(y+)/.test(e)) {
                e = e.replace(RegExp.$1, (c.getFullYear() + "").substr(4 - RegExp.$1.length))
            }
            for (var f in g) {
                if (new RegExp("(" + f + ")").test(e)) {
                    e = e.replace(RegExp.$1, RegExp.$1.length == 1 ? g[f] : ("00" + g[f]).substr(("" + g[f]).length))
                }
            }
            return e
        }, getDate: function (c, g, e) {
            var d = new Date();
            if (!!g) {
                d = d.DateAdd(g, e)
            }
            var f = b.formatDate(d, c);
            return f
        }, getMonth: function () {
            var e = {begin: "", end: ""};
            var c = b.parseDate(b.formatDate(new Date(), "yyyy-MM-01"));
            var d = c.DateAdd("m", 1).DateAdd("d", -1);
            e.begin = b.formatDate(c, "yyyy-MM-dd 00:00:00");
            e.end = b.formatDate(d, "yyyy-MM-dd 23:59:59");
            return e
        }, getPreMonth: function () {
            var e = {begin: "", end: ""};
            var c = b.parseDate(b.formatDate(new Date(), "yyyy-MM-01"));
            var d = c.DateAdd("d", -1);
            e.begin = b.formatDate(d, "yyyy-MM-01 00:00:00");
            e.end = b.formatDate(d, "yyyy-MM-dd 23:59:59");
            return e
        }, getCurrentQuarter: function () {
            var c = new Date();
            return b.getQuarter(c.getFullYear(), c.getMonth())
        }, getPreQuarter: function () {
            var c = new Date().DateAdd("q", -1);
            return b.getQuarter(c.getFullYear(), c.getMonth())
        }, getQuarter: function (e, c) {
            var d = {begin: "", end: ""};
            switch (c) {
                case 0:
                case 1:
                case 2:
                    d.begin = e + "-01-01 00:00:00";
                    d.end = e + "-03-31 23:59:59";
                    break;
                case 3:
                case 4:
                case 5:
                    d.begin = e + "-04-01 00:00:00";
                    d.end = e + "-06-30 23:59:59";
                    break;
                case 6:
                case 7:
                case 8:
                    d.begin = e + "-07-01 00:00:00";
                    d.end = e + "-09-30 23:59:59";
                    break;
                case 9:
                case 10:
                case 11:
                    d.begin = e + "-10-01 00:00:00";
                    d.end = e + "-12-31 23:59:59";
                    break
            }
            return d
        }, getYear: function () {
            var c = new Date();
            var d = {begin: "", end: ""};
            var e = c.getFullYear();
            d.begin = e + "-01-01 00:00:00";
            d.end = e + "-12-31 23:59:59";
            return d
        }, getPreYear: function () {
            var c = new Date();
            var d = {begin: "", end: ""};
            var e = c.getFullYear() - 1;
            d.begin = e + "-01-01 00:00:00";
            d.end = e + "-12-31 23:59:59";
            return d
        }, getFirstHalfYear: function () {
            var c = new Date();
            var d = {begin: "", end: ""};
            var e = c.getFullYear();
            d.begin = e + "-01-01 00:00:00";
            d.end = e + "-06-30 23:59:59";
            return d
        }, getSecondHalfYear: function () {
            var c = new Date();
            var d = {begin: "", end: ""};
            var e = c.getFullYear();
            d.begin = e + "-07-01 00:00:00";
            d.end = e + "-12-31 23:59:59";
            return d
        }
    });
    Date.prototype.DateAdd = function (e, d) {
        var c = this;
        switch (e) {
            case"s":
                return new Date(Date.parse(c) + (1000 * d));
            case"n":
                return new Date(Date.parse(c) + (60000 * d));
            case"h":
                return new Date(Date.parse(c) + (3600000 * d));
            case"d":
                return new Date(Date.parse(c) + (86400000 * d));
            case"w":
                return new Date(Date.parse(c) + ((86400000 * 7) * d));
            case"q":
                return new Date(c.getFullYear(), (c.getMonth()) + d * 3, c.getDate(), c.getHours(), c.getMinutes(), c.getSeconds());
            case"m":
                return new Date(c.getFullYear(), (c.getMonth()) + d, c.getDate(), c.getHours(), c.getMinutes(), c.getSeconds());
            case"y":
                return new Date((c.getFullYear() + d), c.getMonth(), c.getDate(), c.getHours(), c.getMinutes(), c.getSeconds())
        }
    };
    Date.prototype.DateDiff = function (e, c) {
        var d = this;
        if (typeof c == "string") {
            c = b.parseDate(c)
        }
        switch (e) {
            case"s":
                return parseInt((c - d) / 1000);
            case"n":
                return parseInt((c - d) / 60000);
            case"h":
                return parseInt((c - d) / 3600000);
            case"d":
                return parseInt((c - d) / 86400000);
            case"w":
                return parseInt((c - d) / (86400000 * 7));
            case"m":
                return (c.getMonth() + 1) + ((c.getFullYear() - d.getFullYear()) * 12) - (d.getMonth() + 1);
            case"y":
                return c.getFullYear() - d.getFullYear()
        }
    };
    Date.prototype.MaxDayOfDate = function () {
        var f = this;
        var c = f.toArray();
        var d = (new Date(c[0], c[1] + 1, 1));
        var e = d.DateAdd("m", 1);
        var g = dateDiff(d.Format("yyyy-MM-dd"), e.Format("yyyy-MM-dd"));
        return g
    };
    Date.prototype.isLeapYear = function () {
        return (0 == this.getYear() % 4 && ((this.getYear() % 100 != 0) || (this.getYear() % 400 == 0)))
    }
})(jQuery, top.learun);
(function (a, b) {
    b.validator = {
        validReg: function (d, e, c) {
            var f = {code: true, msg: ""};
            if (!e.test(d)) {
                f.code = false;
                f.msg = c
            }
            return f
        }, validRegOrNull: function (d, e, c) {
            var f = {code: true, msg: ""};
            if (d == null || d == undefined || d.length == 0) {
                return f
            }
            if (!e.test(d)) {
                f.code = false;
                f.msg = c
            }
            return f
        }, isNotNull: function (c) {
            var d = {code: true, msg: ""};
            c = a.trim(c);
            if (c == null || c == undefined || c.length == 0) {
                d.code = false;
                d.msg = "不能为空"
            }
            return d
        }, isNum: function (c) {
            return b.validator.validReg(c, /^[-+]?\d+$/, "必须为数字")
        }, isNumOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^[-+]?\d+$/, "数字或空")
        }, isEmail: function (c) {
            return b.validator.validReg(c, /^\w{3,}@\w+(\.\w+)+$/, "必须为E-mail格式")
        }, isEmailOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^\w{3,}@\w+(\.\w+)+$/, "必须为E-mail格式或空")
        }, isEnglishStr: function (c) {
            return b.validator.validReg(c, /^[a-z,A-Z]+$/, "必须为英文字符串")
        }, isEnglishStrOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^[a-z,A-Z]+$/, "必须为英文字符串或空")
        }, isTelephone: function (c) {
            return b.validator.validReg(c, /^(\d{3,4}\-)?[1-9]\d{6,7}$/, "必须为电话格式")
        }, isTelephoneOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^(\d{3,4}\-)?[1-9]\d{6,7}$/, "必须为电话格式或空")
        }, isMobile: function (c) {
            return b.validator.validReg(c, /^(\+\d{2,3}\-)?\d{11}$/, "必须为手机格式")
        }, isMobileOrnull: function (c) {
            return b.validator.validRegOrNull(c, /^(\+\d{2,3}\-)?\d{11}$/, "必须为手机格式或空")
        }, isMobileOrPhone: function (c) {
            var d = {code: true, msg: ""};
            if (!b.validator.isTelephone(c).code && !b.validator.isMobile(c).code) {
                d.code = false;
                d.msg = "为电话格式或手机格式"
            }
            return d
        }, isMobileOrPhoneOrNull: function (c) {
            var d = {code: true, msg: ""};
            if (b.validator.isNotNull(c).code && !b.validator.isTelephone(c).code && !b.validator.isMobile(c).code) {
                d.code = false;
                d.msg = "为电话格式或手机格式或空"
            }
            return d
        }, isUri: function (c) {
            return b.validator.validReg(c, /^http:\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/, "必须为网址格式")
        }, isUriOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^http:\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/, "必须为网址格式或空")
        }, isDate: function (c) {
            return b.validator.validReg(c, /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/, "必须为日期格式")
        }, isDateOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/, "必须为日期格式或空")
        }, isDateTime: function (c) {
            return b.validator.validReg(c, /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/, "必须为日期时间格式")
        }, isDateTimeOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/, "必须为日期时间格式")
        }, isTime: function (c) {
            return b.validator.validReg(c, /^((20|21|22|23|[0-1]\d)\:[0-5][0-9])(\:[0-5][0-9])?$/, "必须为时间格式")
        }, isTimeOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^((20|21|22|23|[0-1]\d)\:[0-5][0-9])(\:[0-5][0-9])?$/, "必须为时间格式或空")
        }, isChinese: function (c) {
            return b.validator.validReg(c, /^[\u0391-\uFFE5]+$/, "必须为中文")
        }, isChineseOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^[\u0391-\uFFE5]+$/, "必须为中文或空")
        }, isZip: function (c) {
            return b.validator.validReg(c, /^\d{6}$/, "必须为邮编格式")
        }, isZipOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^\d{6}$/, "必须为邮编格式或空")
        }, isDouble: function (c) {
            return b.validator.validReg(c, /^[-\+]?\d+(\.\d+)?$/, "必须为小数")
        }, isDoubleOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^[-\+]?\d+(\.\d+)?$/, "必须为小数或空")
        }, isIDCard: function (c) {
            return b.validator.validReg(c, /^\d{15}(\d{2}[A-Za-z0-9;])?$/, "必须为身份证格式")
        }, isIDCardOrNull: function (c) {
            return b.validator.validRegOrNull(c, /^\d{15}(\d{2}[A-Za-z0-9;])?$/, "必须为身份证格式或空")
        }, isIP: function (d) {
            var f = {code: true, msg: ""};
            var e = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g;
            var c = false;
            if (e.test(d)) {
                if (RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256) {
                    c = true
                }
            }
            if (!c) {
                f.code = false;
                f.msg = "必须为IP格式"
            }
            return f
        }, isIPOrNull: function (c) {
            var d = {code: true, msg: ""};
            if (b.validator.isNotNull(c) && !b.validator.isIP(c).code) {
                d.code = false;
                d.msg = "必须为IP格式或空"
            }
            return d
        }, isLenNum: function (d, c) {
            var f = {code: true, msg: ""};
            var e = /^[0-9]+$/;
            d = a.trim(d);
            if (d.length > c || !e.test(d)) {
                f.code = false;
                f.msg = "必须为" + c + "位数字"
            }
            return f
        }, isLenNumOrNull: function (d, c) {
            var e = {code: true, msg: ""};
            if (b.validator.isNotNull(d).code && !b.validator.isLenNum(d)) {
                e.code = false;
                e.msg = "必须为" + c + "位数字或空"
            }
            return e
        }, isLenStr: function (d, c) {
            var e = {code: true, msg: ""};
            d = a.trim(d);
            if (!b.validator.isNotNull(d).code || d.length > c) {
                e.code = false;
                e.msg = "必须小于等于" + c + "位字符"
            }
            return e
        }, isLenStrOrNull: function (d, c) {
            var e = {code: true, msg: ""};
            d = a.trim(d);
            if (b.validator.isNotNull(d).code && d.length > c) {
                e.code = false;
                e.msg = "必须小于等于" + c + "位字符或空"
            }
            return e
        }
    }
})(window.jQuery, top.learun);
(function (a, b) {
    a.extend(b, {
        layerConfirm: function (d, c) {
            top.layer.confirm(d, {btn: ["确认", "取消"], title: "力软提示", icon: 0, skin: "lr-layer",}, function (e) {
                c(true, e)
            }, function (e) {
                c(false, e);
                top.layer.close(e)
            })
        }, layerForm: function (d) {
            var c = {
                id: null,
                title: "系统窗口",
                width: 550,
                height: 400,
                url: "error",
                btn: ["确认", "关闭"],
                callBack: false,
                maxmin: false,
                end: false,
            };
            a.extend(c, d || {});
            c.width = c.width > a(window).width() ? a(window).width() - 10 : c.width;
            c.height = c.height > a(window).height() ? a(window).height() - 10 : c.height;
            var e = top.layer.open({
                id: c.id,
                maxmin: c.maxmin,
                type: 2,
                title: c.title,
                area: [c.width + "px", c.height + "px"],
                btn: c.btn,
                content: d.url,
                skin: c.btn == null ? "lr-layer-nobtn" : "lr-layer",
                success: function (g, f) {
                    top["layer_" + c.id] = b.iframe(a(g).find("iframe").attr("id"), top.frames);
                    g[0].learun_layerid = "layer_" + c.id;
                    if (!!c.btn && g.find(".lr-layer-btn-cb").length == 0) {
                        g.find(".layui-layer-btn").append('<div class="checkbox lr-layer-btn-cb" myIframeId="layer_' + c.id + '" ><label><input checked="checked" type="checkbox" >确认并关闭窗口</label></div>')
                    }
                },
                yes: function (g) {
                    var f = true;
                    if (!!c.callBack) {
                        f = c.callBack("layer_" + c.id)
                    }
                    if (!!f) {
                        b.layerClose("", g)
                    }
                },
                end: function () {
                    top["layer_" + c.id] = null;
                    if (!!c.end) {
                        c.end()
                    }
                }
            })
        }, layerClose: function (h, e) {
            var d;
            if (!!e) {
                d = e
            } else {
                d = top.layer.getFrameIndex(h)
            }
            var g = top.$("#layui-layer" + d);
            var c = g.find(".layui-layer-btn").find(".lr-layer-btn-cb input");
            var f = c.is(":checked");
            if (c.length == 0) {
                f = true
            }
            if (f) {
                top.layer.close(d)
            } else {
                top[g[0].learun_layerid].location.reload()
            }
        }
    })
})(window.jQuery, top.learun);
(function (a, d) {
    var c = {success: 200, fail: 400, exception: 500};
    var b = {code: c.exception, info: "通信异常，请联系管理员！"};
    a.extend(d, {
        httpErrorLog: function (e) {
            d.log(e)
        }, httpCode: c, httpAsyncGet: function (f, e) {
            a.ajax({
                url: f, type: "GET", dataType: "json", async: true, cache: false, success: function (g) {
                    if (g.code == d.httpCode.exception) {
                        d.httpErrorLog(g.info);
                        g.info = "系统异常，请联系管理员！"
                    }
                    e(g)
                }, error: function (i, h, g) {
                    d.httpErrorLog(h);
                    e(b)
                }, beforeSend: function () {
                }, complete: function () {
                }
            })
        }, httpGet: function (g, e) {
            var f = {};
            a.ajax({
                url: g, data: e, type: "GET", dataType: "json", async: false, cache: false, success: function (h) {
                    if (h.code == d.httpCode.exception) {
                        d.httpErrorLog(h.info);
                        h.info = "系统异常，请联系管理员！"
                    }
                    f = h
                }, error: function (j, i, h) {
                    d.httpErrorLog(i)
                }, beforeSend: function () {
                }, complete: function () {
                }
            });
            return f
        }, httpAsyncPost: function (g, f, e) {
            a.ajax({
                url: g, data: f, type: "POST", dataType: "json", async: true, cache: false, success: function (h) {
                    if (h.code == d.httpCode.exception) {
                        d.httpErrorLog(h.info);
                        h.info = "系统异常，请联系管理员！"
                    }
                    e(h)
                }, error: function (j, i, h) {
                    d.httpErrorLog(i);
                    e(b)
                }, beforeSend: function () {
                }, complete: function () {
                }
            })
        }, httpPost: function (g, f, e) {
            a.ajax({
                url: g, data: f, type: "POST", dataType: "json", async: false, cache: false, success: function (h) {
                    if (h.code == d.httpCode.exception) {
                        d.httpErrorLog(h.info);
                        h.info = "系统异常，请联系管理员！"
                    }
                    e(h)
                }, error: function (j, i, h) {
                    d.httpErrorLog(i);
                    e(b)
                }, beforeSend: function () {
                }, complete: function () {
                }
            })
        }, httpAsync: function (g, h, f, e) {
            a.ajax({
                url: h, data: f, type: g, dataType: "json", async: true, cache: false, success: function (i) {
                    if (i.code == d.httpCode.success) {
                        e(i.data)
                    } else {
                        d.httpErrorLog(i.info);
                        e(null)
                    }
                }, error: function (k, j, i) {
                    d.httpErrorLog(j);
                    e(null)
                }, beforeSend: function () {
                }, complete: function () {
                }
            })
        }, deleteForm: function (g, f, e) {
            d.loading(true, "正在删除数据");
            d.httpAsyncPost(g, f, function (h) {
                d.loading(false);
                if (h.code == d.httpCode.success) {
                    if (!!e) {
                        e(h)
                    }
                    d.alert.success(h.info)
                } else {
                    d.alert.error(h.info);
                    d.httpErrorLog(h.info)
                }
                layer.close(layer.index)
            })
        }, postForm: function (g, f, e) {
            d.loading(true, "正在提交数据");
            d.httpAsyncPost(g, f, function (h) {
                d.loading(false);
                if (h.code == d.httpCode.success) {
                    if (!!e) {
                        e(h)
                    }
                    d.alert.success(h.info)
                } else {
                    d.alert.error(h.info);
                    d.httpErrorLog(h.info)
                }
                layer.close(layer.index)
            })
        }
    })
})(window.jQuery, top.learun);
(function (a, i) {
    var b = null;
    var e = {};
    var c = {};
    var d = {};
    var j = {no: -1, yes: 1, ing: 0, fail: 2};

    function f() {
        a.each(d.excelImportTemplate, function (k, l) {
            d.excelImportTemplate[k] = {keys: l}
        })
    }

    function g(m, k) {
        var o = "";
        var n = k.length;
        if (n == undefined) {
            o = k[m]
        } else {
            for (var l = 0; l < n; l++) {
                if (m(k[l])) {
                    o = k[l];
                    break
                }
            }
        }
        return o
    }

    function h() {
        var m = j.yes;
        for (var l in e) {
            var k = e[l];
            if (k.state == j.fail) {
                m = j.fail;
                break
            } else {
                if (k.state == j.no) {
                    m = j.ing;
                    k.init()
                } else {
                    if (k.state == j.ing) {
                        m = j.ing
                    }
                }
            }
        }
        return m
    }

    i.clientdata = {
        init: function (k) {
            if (b == null) {
                b = k
            }
            var l = h();
            if (l == j.yes) {
                b(true)
            } else {
                if (l == j.ing) {
                    setTimeout(i.clientdata.init, 100)
                } else {
                    b(false)
                }
            }
        }, get: function (n) {
            var o = "";
            if (!n) {
                return o
            }
            var m = n.length;
            var k = d;
            for (var l = 0; l < m; l++) {
                o = g(n[l], k);
                if (o != "" && o != undefined) {
                    k = o
                } else {
                    break
                }
            }
            o = o || "";
            return o
        }, getAsync: function (k, l) {
            return c[k].get(l)
        }
    };
    e.modules = {
        state: j.no, init: function () {
            e.modules.state = j.ing;
            i.httpAsyncGet(a.rootUrl + "/LR_SystemModule/Module/GetModuleList", function (k) {
                if (k.code == i.httpCode.success) {
                    d.modules = k.data;
                    e.modules.toMap();
                    e.modules.state = j.yes
                } else {
                    d.modules = [];
                    e.modules.toMap();
                    e.modules.state = j.fail
                }
            })
        }, toMap: function () {
            var o = {};
            var n = {};
            var l = d.modules.length;
            for (var m = 0; m < l; m++) {
                var k = d.modules[m];
                if (k.F_EnabledMark == 1) {
                    o[k.F_ParentId] = o[k.F_ParentId] || [];
                    o[k.F_ParentId].push(k);
                    n[k.F_ModuleId] = k
                }
            }
            d.modulesTree = o;
            d.modulesMap = n
        }
    };
    e.userinfo = {
        state: j.no, init: function () {
            e.userinfo.state = j.ing;
            i.httpAsyncGet(a.rootUrl + "/Login/GetUserInfo", function (k) {
                if (k.code == i.httpCode.success) {
                    d.userinfo = k.data;
                    e.userinfo.state = j.yes
                } else {
                    e.userinfo.state = j.fail
                }
            })
        }
    };
    c.company = {
        timeout: 300000, states: j.no, get: function (l) {
            if (c.company.states == j.no) {
                c.company.states = j.ing;
                c.company.load()
            }
            if (c.company.states == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.company.get(m)
                }, 100)
            } else {
                var k = d.company;
                if (!!k) {
                    l.callback(c.company.find(l.key, k), l)
                } else {
                    l.callback({}, l)
                }
            }
        }, load: function () {
            i.httpAsync("GET", top.$.rootUrl + "/LR_OrganizationModule/Company/GetList", null, function (k) {
                if (!!k) {
                    d.company = k
                }
                c.company.states = j.yes;
                setTimeout(function () {
                    c.company.states = j.no
                }, c.company.timeout)
            })
        }, find: function (n, k) {
            var p = {};
            for (var m = 0, o = k.length; m < o; m++) {
                if (k[m].F_CompanyId == n) {
                    p = k[m];
                    break
                }
            }
            return p
        }
    };
    c.department = {
        timeout: 300000, states: {}, get: function (l) {
            if (c.department.states[l.companyId] == undefined || c.department.states[l.companyId] == j.no) {
                c.department.states[l.companyId] = j.ing;
                c.department.load(l.companyId)
            }
            if (c.department.states[l.companyId] == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.department.get(m)
                }, 100)
            } else {
                var k = d[l.companyId];
                if (!!k) {
                    l.callback(c.department.find(l.key, k))
                } else {
                    l.callback({})
                }
            }
        }, load: function (k) {
            i.httpAsync("GET", top.$.rootUrl + "/LR_OrganizationModule/Department/GetList", {companyId: k}, function (l) {
                if (!!l) {
                    d[k] = l
                }
                c.department.states[k] = j.yes;
                setTimeout(function () {
                    c.department.states[k] = j.no
                }, c.department.timeout)
            })
        }, find: function (n, k) {
            var p = {};
            for (var m = 0, o = k.length; m < o; m++) {
                if (k[m].F_DepartmentId == n) {
                    p = k[m];
                    break
                }
            }
            return p
        }
    };
    c.departmentone = {
        states: {}, get: function (l) {
            d.departmentone = d.departmentone || {};
            if (c.departmentone.states[l.departmentId] == undefined || c.departmentone.states[l.departmentId] == j.no) {
                c.departmentone.states[l.departmentId] = j.ing;
                c.departmentone.load(l.departmentId)
            }
            if (c.departmentone.states[l.departmentId] == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.departmentone.get(m)
                }, 100)
            } else {
                var k = d.departmentone[l.departmentId];
                if (!!k) {
                    l.callback(k, l)
                } else {
                    l.callback({}, l)
                }
            }
        }, load: function (k) {
            i.httpAsync("GET", top.$.rootUrl + "/LR_OrganizationModule/Department/GetEntity", {departmentId: k}, function (l) {
                if (!!l) {
                    d.departmentone[k] = l
                }
                c.departmentone.states[k] = j.yes
            })
        }
    };
    c.user = {
        states: {}, get: function (l) {
            d.user = d.user || {};
            if (c.user.states[l.userId] == undefined || c.user.states[l.userId] == j.no) {
                c.user.states[l.userId] = j.ing;
                c.user.load(l.userId)
            }
            if (c.user.states[l.userId] == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.user.get(m)
                }, 100)
            } else {
                var k = d.user[l.userId];
                if (!!k) {
                    l.callback(k, l)
                } else {
                    l.callback({}, l)
                }
            }
        }, load: function (k) {
            i.httpAsync("GET", top.$.rootUrl + "/LR_OrganizationModule/User/GetUserEntity", {userId: k}, function (l) {
                if (!!l) {
                    d.user[k] = l
                }
                c.user.states[k] = j.yes
            })
        }
    };
    c.db = {
        timeout: 600000, states: j.no, get: function (l) {
            if (c.db.states == j.no) {
                c.db.states = j.ing;
                c.db.load()
            }
            if (c.db.states == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.db.get(m)
                }, 100)
            } else {
                var k = d.db;
                if (!!k) {
                    l.callback(c.db.find(l.key, k))
                } else {
                    l.callback({})
                }
            }
        }, load: function () {
            i.httpAsync("GET", top.$.rootUrl + "/LR_SystemModule/DatabaseLink/GetList", null, function (k) {
                if (!!k) {
                    d.db = k
                }
                c.db.states = j.yes;
                setTimeout(function () {
                    c.db.states = j.no
                }, c.db.timeout)
            })
        }, find: function (n, k) {
            var p = {};
            for (var m = 0, o = k.length; m < o; m++) {
                if (k[m].F_DatabaseLinkId == n) {
                    p = k[m];
                    break
                }
            }
            return p
        }
    };
    c.dataItem = {
        states: {}, get: function (l) {
            d.dataItem = d.dataItem || {};
            if (c.dataItem.states[l.itemCode] == undefined || c.dataItem.states[l.itemCode] == j.no) {
                c.dataItem.states[l.itemCode] = j.ing;
                c.dataItem.load(l.itemCode)
            }
            if (c.dataItem.states[l.itemCode] == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.dataItem.get(m)
                }, 100)
            } else {
                var k = d.dataItem[l.itemCode];
                if (!!k) {
                    l.callback(c.dataItem.find(l.key, k))
                } else {
                    l.callback({})
                }
            }
        }, load: function (k) {
            i.httpAsync("GET", top.$.rootUrl + "/LR_SystemModule/DataItem/GetDetailList", {itemCode: k}, function (l) {
                if (!!l) {
                    d.dataItem[k] = l
                }
                c.dataItem.states[k] = j.yes
            })
        }, find: function (n, k) {
            var p = {};
            for (var m = 0, o = k.length; m < o; m++) {
                if (k[m].F_ItemValue == n) {
                    p = k[m];
                    break
                }
            }
            return p
        }
    };
    c.custmerData = {
        timeout: 300000, states: {}, get: function (l) {
            if (c.custmerData.states[l.url] == undefined || c.custmerData.states[l.url] == j.no) {
                c.custmerData.states[l.url] = j.ing;
                c.custmerData.load(l.url)
            }
            if (c.custmerData.states[l.url] == j.ing) {
                var m = l;
                setTimeout(function () {
                    c.custmerData.get(m)
                }, 100)
            } else {
                var k = d[l.url];
                if (!!k) {
                    l.callback(c.custmerData.find(l.key, l.valueId, k))
                } else {
                    l.callback({})
                }
            }
        }, load: function (k) {
            i.httpAsync("GET", top.$.rootUrl + k, {}, function (l) {
                if (!!l) {
                    d[k] = l
                }
                c.custmerData.states[k] = j.yes;
                setTimeout(function () {
                    c.custmerData.states[k] = j.no
                }, c.custmerData.timeout)
            })
        }, find: function (n, q, k) {
            var p = {};
            for (var m = 0, o = k.length; m < o; m++) {
                if (k[m][q] == n) {
                    p = k[m];
                    break
                }
            }
            return p
        }
    }
})(window.jQuery, top.learun);
(function (a, b) {
    a.lrtree = {
        getItem: function (f, d) {
            var c = f.split(".");
            var g = d.data;
            for (var e = 0; e < c.length; e++) {
                if (e == 0) {
                    g = g[c[e]]
                } else {
                    g = g.ChildNodes[c[e]]
                }
            }
            return g
        }, render: function (d) {
            var g = d[0]._lrtree.dfop;
            var e = a('<ul class="lr-tree-root" ></ul>');
            var f = g.data.length;
            for (var h = 0; h < f; h++) {
                var c = a.lrtree.renderNode(g.data[h], 0, h, g);
                e.append(c)
            }
            d.append(e);
            d.mCustomScrollbar({theme: "minimal-dark"});
            g = null
        }, renderNode: function (v, p, w, q) {
            if (v.shide) {
                return ""
            }
            v._deep = p;
            v._path = w;
            var u = v.id.replace(/[^\w]/gi, "_");
            var x = v.title || v.text;
            var g = a('<li class="lr-tree-node"></li>');
            var h = a('<div id="' + q.id + "_" + u + '" tpath="' + w + '" title="' + x + '"  dataId="' + q.id + '"  class="lr-tree-node-el" ></div>');
            if (v.hasChildren) {
                var o = (v.isexpand || q.isAllExpand) ? "lr-tree-node-expanded" : "lr-tree-node-collapsed";
                h.addClass(o)
            } else {
                h.addClass("lr-tree-node-leaf")
            }
            var i = a('<span class="lr-tree-node-indent"></span>');
            if (p == 1) {
                i.append('<img class="lr-tree-icon" src="' + q.cbiconpath + 's.gif"/>')
            } else {
                if (p > 1) {
                    i.append('<img class="lr-tree-icon" src="' + q.cbiconpath + 's.gif"/>');
                    for (var r = 1; r < p; r++) {
                        i.append('<img class="lr-tree-icon" src="' + q.cbiconpath + 's.gif"/>')
                    }
                }
            }
            h.append(i);
            var f = a('<img class="lr-tree-ec-icon" src="' + q.cbiconpath + 's.gif"/>');
            h.append(f);
            if (v.showcheck) {
                if (v.checkstate == null || v.checkstate == undefined) {
                    v.checkstate = 0
                }
                var d = a('<img  id="' + q.id + "_" + u + '_cb" + class="lr-tree-node-cb" src="' + q.cbiconpath + q.icons[v.checkstate] + '" />');
                h.append(d)
            }
            if (v.icon != -1) {
                if (!!v.icon) {
                    h.append('<i class="' + v.icon + '"></i>&nbsp;')
                } else {
                    if (v.hasChildren) {
                        if (v.isexpand || q.isAllExpand) {
                            h.append('<i class="fa fa-folder-open" style="width:15px">&nbsp;</i>')
                        } else {
                            h.append('<i class="fa fa-folder" style="width:15px">&nbsp;</i>')
                        }
                    } else {
                        h.append('<i class="fa fa-file-o"></i>&nbsp;')
                    }
                }
            }
            var n = '<a class="lr-tree-node-anchor" href="javascript:void(0);">';
            n += '<span data-value="' + v.id + '" class="lr-tree-node-text" >' + v.text + "</span>";
            n += "</a>";
            h.append(n);
            h.on("click", a.lrtree.nodeClick);
            if (!v.complete) {
                h.append('<div class="lr-tree-loading"><img class="lr-tree-ec-icon" src="' + q.cbiconpath + 'loading.gif"/></div>')
            }
            g.append(h);
            if (v.hasChildren) {
                var m = a('<ul  class="lr-tree-node-ct" >');
                if (!v.isexpand && !q.isAllExpand) {
                    m.css("display", "none")
                }
                if (v.ChildNodes) {
                    var t = v.ChildNodes.length;
                    for (var s = 0; s < t; s++) {
                        v.ChildNodes[s].parent = v;
                        var e = a.lrtree.renderNode(v.ChildNodes[s], p + 1, w + "." + s, q);
                        m.append(e)
                    }
                    g.append(m)
                }
            }
            v.render = true;
            q = null;
            return g
        }, renderNodeAsync: function (d, i, f) {
            var e = a('<ul  class="lr-tree-node-ct" >');
            if (!i.isexpand && !f.isAllExpand) {
                e.css("display", "none")
            }
            if (i.ChildNodes) {
                var h = i.ChildNodes.length;
                for (var g = 0; g < h; g++) {
                    i.ChildNodes[g].parent = i;
                    var c = a.lrtree.renderNode(i.ChildNodes[g], i._deep + 1, i._path + "." + g, f);
                    e.append(c)
                }
                d.parent().append(e)
            }
            return e
        }, renderToo: function (d) {
            var g = d[0]._lrtree.dfop;
            var e = d.find(".lr-tree-root");
            e.html("");
            var f = g.data.length;
            for (var h = 0; h < f; h++) {
                var c = a.lrtree.renderNode(g.data[h], 0, h, g);
                e.append(c)
            }
            g = null
        }, nodeClick: function (i) {
            var j = i.target || i.srcElement;
            var f = a(this);
            var d = a("#" + f.attr("dataId"));
            var h = d[0]._lrtree.dfop;
            if (j.tagName == "IMG") {
                var c = a(j);
                var g = f.next(".lr-tree-node-ct");
                if (c.hasClass("lr-tree-ec-icon")) {
                    if (f.hasClass("lr-tree-node-expanded")) {
                        g.slideUp(200, function () {
                            f.removeClass("lr-tree-node-expanded");
                            f.addClass("lr-tree-node-collapsed")
                        })
                    } else {
                        if (f.hasClass("lr-tree-node-collapsed")) {
                            var l = f.attr("tpath");
                            var k = a.lrtree.getItem(l, h);
                            if (!k.complete) {
                                if (!k._loading) {
                                    k._loading = true;
                                    f.find(".lr-tree-loading").show();
                                    b.httpAsync("GET", h.url, {parentId: k.id}, function (e) {
                                        if (!!e) {
                                            k.ChildNodes = e;
                                            g = a.lrtree.renderNodeAsync(f, k, h);
                                            g.slideDown(200, function () {
                                                f.removeClass("lr-tree-node-collapsed");
                                                f.addClass("lr-tree-node-expanded")
                                            });
                                            k.complete = true;
                                            f.find(".lr-tree-loading").hide()
                                        }
                                        k._loading = false
                                    })
                                }
                            } else {
                                g.slideDown(200, function () {
                                    f.removeClass("lr-tree-node-collapsed");
                                    f.addClass("lr-tree-node-expanded")
                                })
                            }
                        }
                    }
                } else {
                    if (c.hasClass("lr-tree-node-cb")) {
                        var l = f.attr("tpath");
                        var k = a.lrtree.getItem(l, h);
                        if (k.checkstate == 1) {
                            k.checkstate = 0
                        } else {
                            k.checkstate = 1
                        }
                        c.attr("src", h.cbiconpath + h.icons[k.checkstate]);
                        a.lrtree.checkChild(a.lrtree.check, k, k.checkstate, h);
                        a.lrtree.checkParent(a.lrtree.check, k, k.checkstate, h);
                        if (!!h.nodeCheck) {
                            h.nodeCheck(k, f)
                        }
                    }
                }
            } else {
                var l = f.attr("tpath");
                var k = a.lrtree.getItem(l, h);
                h.currentItem = k;
                a("#" + h.id).find(".lr-tree-selected").removeClass("lr-tree-selected");
                f.addClass("lr-tree-selected");
                if (!!h.nodeClick) {
                    h.nodeClick(k, f)
                }
            }
            return false
        }, check: function (h, n, o, e) {
            var m = h.checkstate;
            if (o == 1) {
                h.checkstate = n
            } else {
                var d = h.ChildNodes;
                var j = d.length;
                var c = true;
                for (var g = 0; g < j; g++) {
                    d[g].checkstate = d[g].checkstate || 0;
                    if ((n == 1 && d[g].checkstate != 1) || n == 0 && d[g].checkstate != 0) {
                        c = false;
                        break
                    }
                }
                if (c) {
                    h.checkstate = n
                } else {
                    h.checkstate = 2
                }
            }
            if (h.render && m != h.checkstate) {
                var k = h.id.replace(/[^\w]/gi, "_");
                var f = a("#" + e.id + "_" + k + "_cb");
                if (f.length == 1) {
                    f.attr("src", e.cbiconpath + e.icons[h.checkstate])
                }
            }
        }, checkParent: function (d, e, h, c) {
            var f = e.parent;
            while (f) {
                var g = d(f, h, 0, c);
                if (g === false) {
                    break
                }
                f = f.parent
            }
        }, checkChild: function (e, h, j, d) {
            if (e(h, j, 1, d) != false) {
                if (h.ChildNodes != null && h.ChildNodes.length > 0) {
                    var c = h.ChildNodes;
                    for (var f = 0, g = c.length; f < g; f++) {
                        a.lrtree.checkChild(e, c[f], j, d)
                    }
                }
            }
        }, search: function (d, c) {
            var e = false;
            a.each(c, function (g, h) {
                var f = false;
                if (!b.validator.isNotNull(d).code || h.text.indexOf(d) != -1) {
                    f = true
                }
                if (h.hasChildren) {
                    if (a.lrtree.search(d, h.ChildNodes)) {
                        f = true
                    }
                }
                if (f) {
                    e = true;
                    h.isexpand = true;
                    h.shide = false
                } else {
                    h.shide = true
                }
            });
            return e
        }, findItem: function (e, f, g) {
            var d = null;
            c(e, f, g);

            function c(h, j, k) {
                for (var m = 0, n = h.length; m < n; m++) {
                    if (h[m][f] == g) {
                        d = h[m];
                        return true
                    }
                    if (h[m].hasChildren && h[m].ChildNodes.length > 0) {
                        if (c(h[m].ChildNodes, j, k)) {
                            return true
                        }
                    }
                }
                return false
            }

            return d
        }, listTotree: function (e, m, g, o, p, d) {
            var n = [];
            var k = {};
            for (var f = 0, j = e.length; f < j; f++) {
                var h = e[f];
                k[h[m]] = k[h[m]] || [];
                k[h[m]].push(h)
            }
            c(n, "0");

            function c(i, v) {
                var u = k[v] || [];
                for (var s = 0, t = u.length; s < t; s++) {
                    var q = u[s];
                    var r = {
                        id: q[g],
                        text: q[o],
                        value: q[p],
                        showcheck: d,
                        checkstate: false,
                        hasChildren: false,
                        isexpand: false,
                        complete: true,
                        ChildNodes: []
                    };
                    if (c(r.ChildNodes, q[g])) {
                        r.hasChildren = true;
                        r.isexpand = true
                    }
                    i.push(r)
                }
                return i.length > 0
            }

            return n
        }, treeTotree: function (f, g, i, j, d, e) {
            var h = [];
            c(h, f);

            function c(q, n) {
                for (var o = 0, p = n.length; o < p; o++) {
                    var k = n[o];
                    var m = {
                        id: k[g],
                        text: k[i],
                        value: k[j],
                        showcheck: d,
                        checkstate: false,
                        hasChildren: false,
                        isexpand: true,
                        complete: true,
                        ChildNodes: []
                    };
                    if (k[e].length > 0) {
                        m.hasChildren = true;
                        c(m.ChildNodes, k[e])
                    }
                    q.push(m)
                }
            }

            return h
        }, addNode: function (e, i, g, h) {
            var f = e[0]._lrtree.dfop;
            if (!!g) {
                f.data.splice(h, 0, i);
                var c = a.lrtree.renderNode(i, 0, h, f);
                if (e.find(".lr-tree-root>li").length == 0) {
                    e.find(".lr-tree-root>li").append(c)
                } else {
                    e.find(".lr-tree-root>li").eq(h).before(c)
                }
            } else {
                var d = e.find("#" + f.id + "_" + g);
                var j = d.attr("tpath");
                var c = a.lrtree.renderNode(i, 0, j + "." + h, f);
                if (d.next().children().length == 0) {
                    d.next().children().append(c)
                } else {
                    d.next().children().eq(h).before(c)
                }
            }
        }, setValue: function (c) {
            var d = c[0]._lrtree.dfop;
            if (d.data.length == 0) {
                setTimeout(function () {
                    a.lrtree.setValue(c)
                }, 100)
            } else {
                c.find('span[data-value="' + d._value + '"]').trigger("click")
            }
        }
    };
    a.fn.lrtree = function (g) {
        var d = {
            icons: ["checkbox_0.png", "checkbox_1.png", "checkbox_2.png"],
            method: "GET",
            url: false,
            param: null,
            data: [],
            isAllExpand: false,
            cbiconpath: "/Content/images/learuntree/",
            nodeClick: false,
            nodeCheck: false
        };
        a.extend(d, g);
        var c = a(this);
        d.id = c.attr("id");
        if (d.id == null || d.id == "") {
            d.id = "learuntree" + new Date().getTime();
            c.attr("id", d.id)
        }
        c.html("");
        c.addClass("lr-tree");
        c[0]._lrtree = {dfop: d};
        c[0]._lrtree.dfop.backupData = d.data;
        if (d.url) {
            b.httpAsync(d.method, d.url, d.param, function (h) {
                c[0]._lrtree.dfop.data = h || [];
                c[0]._lrtree.dfop.backupData = c[0]._lrtree.dfop.data;
                a.lrtree.render(c)
            })
        } else {
            a.lrtree.render(c)
        }
        if (d.showcheck) {
            for (var e = 0; e < 3; e++) {
                var f = new Image();
                f.src = d.cbiconpath + d.icons[e]
            }
        }
        d = null;
        return c
    };
    a.fn.lrtreeSet = function (i, j) {
        var c = a(this);
        var e = c[0]._lrtree.dfop;
        var f = function (p, m, n) {
            for (var o = 0, q = p.length; o < q; o++) {
                if (c.find("#" + e.id + "_" + p[o].id.replace(/-/g, "_")).parent().css("display") != "none") {
                    (p[o].showcheck == true && (p[o].checkstate == 1 || p[o].checkstate == 2)) && m.push(n(p[o]));
                    if (!p[o].showcheck || (p[o].showcheck == true && (p[o].checkstate == 1 || p[o].checkstate == 2))) {
                        if (p[o].ChildNodes != null && p[o].ChildNodes.length > 0) {
                            f(p[o].ChildNodes, m, n)
                        }
                    }
                }
            }
        };
        var g = function (p, m, n) {
            for (var o = 0, q = p.length; o < q; o++) {
                (p[o].showcheck == true && (p[o].checkstate == 1 || p[o].checkstate == 2) && !p[o].hasChildren) && m.push(n(p[o]));
                if (!p[o].showcheck || (p[o].showcheck == true && (p[o].checkstate == 1 || p[o].checkstate == 2))) {
                    if (p[o].ChildNodes != null && p[o].ChildNodes.length > 0) {
                        g(p[o].ChildNodes, m, n)
                    }
                }
            }
        };
        var l = function (p, m, n) {
            for (var o = 0, q = p.length; o < q; o++) {
                if (p[o].showcheck) {
                    p[o].checkstate = 0
                }
                if (p[o].ChildNodes != null && p[o].ChildNodes.length > 0) {
                    l(p[o].ChildNodes)
                }
            }
        };
        switch (i) {
            case"allNoCheck":
                c.find(".lr-tree-node-cb").attr("src", e.cbiconpath + "checkbox_0.png");
                l(e.data);
                break;
            case"allCheck":
                c.find('.lr-tree-node-cb[src$="checkbox_0.png"]').trigger("click");
                break;
            case"setCheck":
                var h = j;
                a.each(h, function (n, o) {
                    var m = c.find("#" + e.id + "_" + o.replace(/-/g, "_"));
                    if (m.next().length == 0) {
                        m.find(".lr-tree-node-cb").trigger("click")
                    }
                });
                break;
            case"setValue":
                e._value = j;
                a.lrtree.setValue(c);
                break;
            case"currentItem":
                return e.currentItem;
                break;
            case"getCheckNodesEx":
                var d = [];
                g(e.data, d, function (m) {
                    return m
                });
                return d;
                break;
            case"getCheckNodes":
                var d = [];
                f(e.data, d, function (m) {
                    return m
                });
                return d;
                break;
            case"getCheckNodeIds":
                var d = [];
                f(e.data, d, function (m) {
                    return m.id
                });
                return d;
                break;
            case"getCheckNodeIdsByPath":
                var d = [];
                var k;
                f(e.data, d, function (m) {
                    return m.id
                });
                return d;
                break;
            case"search":
                a.lrtree.search(j.keyword, e.data);
                if (b.validator.isNotNull(j.keyword).code) {
                    e._isSearch = true
                } else {
                    if (e._isSearch) {
                        e._isSearch = false
                    }
                }
                a.lrtree.renderToo(c);
                break;
            case"refresh":
                a.extend(e, j || {});
                if (!!e.url) {
                    b.httpAsync(e.method, e.url, e.param, function (m) {
                        c[0]._lrtree.dfop.data = m || [];
                        c[0]._lrtree.dfop.backupData = c[0]._lrtree.dfop.data;
                        a.lrtree.renderToo(c);
                        e._isSearch = false
                    })
                } else {
                    c[0]._lrtree.dfop.backupData = c[0]._lrtree.dfop.data;
                    a.lrtree.renderToo(c);
                    e._isSearch = false
                }
                break;
            case"addNode":
                break;
            case"updateNode":
                break
        }
    }
})(jQuery, top.learun);
(function (a, b) {
    a.lrselect = {
        htmlToData: function (c) {
            var e = c[0]._lrselect.dfop;
            var d = c.find("ul");
            e.data = [];
            d.find("li").each(function () {
                var f = a(this);
                var g = {id: f.attr("data-value"), text: f.html()};
                e.data.push(g)
            });
            d.remove();
            d = null;
            e = null
        }, initRender: function (h, f) {
            var c = a('<div class="lr-select-option" id="learun_select_option_' + h.id + '"></div>');
            var d = a('<div class="lr-select-option-content"></div>');
            var g = a('<ul id="learun_select_option_content' + h.id + '"></ul>');
            d.css("max-height", h.maxHeight + "px");
            c.hide();
            d.html(g);
            c.prepend(d);
            if (h.allowSearch) {
                var e = a('<div class="lr-select-option-search"><input type="text" placeholder="搜索关键字"><span class="input-query" title="查询"><i class="fa fa-search"></i></span></div>');
                c.append(e);
                c.css("padding-bottom", "25px");
                e.on("click", function () {
                    return false
                });
                e.find("input").on("keypress", function (p) {
                    if (event.keyCode == "13") {
                        var m = a(this);
                        var r = m.val();
                        var k = m.parents(".lr-select");
                        var o = k[0]._lrselect.dfop;
                        if (o.type == "tree" || o.type == "treemultiple") {
                            var j = m.parent().prev();
                            j.lrtreeSet("search", {keyword: r})
                        } else {
                            if (o.type == "default" || o.type == "multiple") {
                                console.log(r);
                                for (var q = 0, s = o.data.length; q < s; q++) {
                                    var n = o.data[q];
                                    if (!r || n[o.text].indexOf(r) != -1) {
                                        n._lrhide = false
                                    } else {
                                        n._lrhide = true
                                    }
                                }
                                a.lrselect.render(o)
                            }
                        }
                    }
                })
            }
            f.append(c);
            f.append('<div class="lr-select-placeholder" >==' + h.placeholder + "==</div>");
            f.attr("type", "lrselect").addClass("lr-select");
            if (h.type != "tree") {
                d.mCustomScrollbar({theme: "minimal-dark"})
            }
        }, render: function (c) {
            switch (c.type) {
                case"default":
                    a.lrselect.defaultRender(c);
                    break;
                case"tree":
                case"treemultiple":
                    a.lrselect.treeRender(c);
                    break;
                case"gird":
                    break;
                case"multiple":
                    a.lrselect.multipleRender(c);
                    break;
                default:
                    break
            }
            c.isrender = true
        }, defaultRender: function (e) {
            var d = a("#learun_select_option_content" + e.id);
            d.html("");
            if (!!e.placeholder) {
                d.append('<li data-value="-1" class="lr-selectitem-li" >==' + e.placeholder + "==</li>")
            }
            for (var f = 0, h = e.data.length; f < h; f++) {
                var g = e.data[f];
                if (!g._lrhide) {
                    var c = a('<li data-value="' + f + '" class="lr-selectitem-li" >' + g[e.text] + "</li>");
                    d.append(c)
                }
            }
        }, multipleRender: function (e) {
            var d = a("#learun_select_option_content" + e.id);
            d.html("");
            if (!!e.placeholder) {
                d.append('<li data-value="-1" class="lr-selectitem-li" >==' + e.placeholder + "==</li>")
            }
            for (var f = 0, h = e.data.length; f < h; f++) {
                var g = e.data[f];
                if (!g._lrhide) {
                    if (!!e.multipleMapValue && e.multipleMapValue[f] != undefined) {
                        var c = a('<li data-value="' + f + '" class="lr-selectitem-li" ><img class="lr-select-node-cb" src="/Content/images/learuntree/checkbox_1.png">' + g[e.text] + "</li>");
                        d.append(c)
                    } else {
                        var c = a('<li data-value="' + f + '" class="lr-selectitem-li" ><img class="lr-select-node-cb" src="/Content/images/learuntree/checkbox_0.png">' + g[e.text] + "</li>");
                        d.append(c)
                    }
                }
            }
        }, treeRender: function (e) {
            var c = a("#learun_select_option_" + e.id);
            c.find(".lr-select-option-content").remove();
            var d = a('<div class="lr-select-option-content"></div>');
            c.prepend(d);
            d.css("max-height", e.maxHeight + "px");
            e.data.unshift({
                id: "-1",
                text: "==" + e.placeholder + "==",
                value: "-1",
                icon: "-1",
                parentnodes: "0",
                showcheck: false,
                isexpand: false,
                complete: true,
                hasChildren: false,
                ChildNodes: []
            });
            var f = {data: e.data, nodeClick: a.lrselect.treeNodeClick};
            if (e.type == "treemultiple") {
                f.nodeClick = a.lrselect.treeNodeClick2;
                f.nodeCheck = a.lrselect.treeNodeCheck
            }
            d.lrtree(f)
        }, bindEvent: function (c) {
            c.unbind("click");
            c.on("click", a.lrselect.click);
            a(document).click(function (d) {
                a(".lr-select-option").slideUp(150);
                a(".lr-select").removeClass("lr-select-focus")
            })
        }, click: function (k) {
            var h = a(this);
            if (h.attr("readonly") == "readonly" || h.attr("disabled") == "disabled") {
                return false
            }
            var j = h[0]._lrselect.dfop;
            if (!j.isload) {
                return false
            }
            if (!j.isrender) {
                a.lrselect.render(j)
            }
            var l = k.target || k.srcElement;
            var d = a(l);
            var g = a("#learun_select_option_" + j.id);
            if (g.is(":hidden")) {
                a(".lr-select-option").slideUp(150);
                a(".lr-select").removeClass("lr-select-focus");
                h.addClass("lr-select-focus");
                var n = j.width || h.parent().width();
                g.css("width", n).show();
                g.find(".lr-select-option-search").find("input").select()
            } else {
                if (j.type != "multiple") {
                    g.slideUp(150);
                    h.removeClass("lr-select-focus")
                }
            }
            if (j.type != "multiple") {
                if (d.hasClass("lr-selectitem-li")) {
                    var i = d.attr("data-value");
                    if (j._index != i) {
                        var f = h.find(".lr-select-placeholder");
                        if (i == -1) {
                            f.css("color", "#999");
                            f.html("==" + j.placeholder + "==")
                        } else {
                            f.css("color", "#000");
                            f.html(j.data[i][j.text])
                        }
                        d.addClass("selected");
                        if (j._index != undefined && j._index != null) {
                            g.find('.lr-selectitem-li[data-value="' + j._index + '"]').removeClass("selected")
                        }
                        j._index = i;
                        h.trigger("change");
                        if (!!j.select) {
                            j.select(j.data[i])
                        }
                    }
                }
            } else {
                if (d.hasClass("lr-selectitem-li") || d.hasClass("lr-select-node-cb")) {
                    var f = h.find(".lr-select-placeholder");
                    var c = d.find(".lr-select-node-cb");
                    var i = d.attr("data-value");
                    if (d.hasClass("lr-select-node-cb")) {
                        c = d;
                        i = d.parent().attr("data-value")
                    }
                    j.multipleMapValue = j.multipleMapValue || {};
                    j.multipleValue = j.multipleValue || [];
                    j.multipleText = j.multipleText || [];
                    if (j._index != undefined && j._index != null) {
                        g.find('.lr-selectitem-li[data-value="' + j._index + '"]').removeClass("selected")
                    }
                    if (i == -1) {
                        f.css("color", "#999");
                        f.html("==" + j.placeholder + "==");
                        j.multipleMapValue = {};
                        j.multipleValue = [];
                        j.multipleText = [];
                        g.find('.lr-select-node-cb[src$="checkbox_1.png"]').attr("src", "/Content/images/learuntree/checkbox_0.png");
                        g.slideUp(150);
                        h.removeClass("lr-select-focus")
                    } else {
                        var m = true;
                        if (j.multipleMapValue[i] == undefined) {
                            f.css("color", "#000");
                            j.multipleValue.push(j.data[i][j.value]);
                            j.multipleText.push(j.data[i][j.text]);
                            j.multipleMapValue[i] = j.multipleText.length - 1;
                            f.html(String(j.multipleText));
                            c.attr("src", "/Content/images/learuntree/checkbox_1.png")
                        } else {
                            j.multipleText.splice(j.multipleMapValue[i], 1);
                            j.multipleValue.splice(j.multipleMapValue[i], 1);
                            delete j.multipleMapValue[i];
                            if (j.multipleText.length == 0) {
                                f.css("color", "#999");
                                f.html("==" + j.placeholder + "==")
                            } else {
                                f.html(String(j.multipleText))
                            }
                            m = false;
                            c.attr("src", "/Content/images/learuntree/checkbox_0.png")
                        }
                        h.trigger("change");
                        if (!!j.select) {
                            j.select(j.data[i], m, h)
                        }
                    }
                }
            }
            j = null;
            k.stopPropagation()
        }, treeNodeClick: function (g, d) {
            d.parents(".lr-select-option").slideUp(150);
            var e = d.parents(".lr-select");
            var f = e[0]._lrselect.dfop;
            e.removeClass("lr-select-focus");
            f.currtentItem = g;
            var c = e.find(".lr-select-placeholder");
            c.html(f.currtentItem.text);
            if (g.value == "-1") {
                c.css("color", "#999")
            } else {
                c.css("color", "#000")
            }
            e.trigger("change");
            if (!!f.select) {
                f.select(f.currtentItem)
            }
        }, treeNodeClick2: function (g, d) {
            $tree = d.parents(".lr-select-option-content");
            var e = d.parents(".lr-select");
            var f = e[0]._lrselect.dfop;
            e.removeClass("lr-select-focus");
            f.currtentItems = [];
            if (g.value == "-1") {
                d.parents(".lr-select-option").slideUp(150);
                $tree.lrtreeSet("allNoCheck");
                var c = e.find(".lr-select-placeholder");
                c.html(g.text);
                c.css("color", "#999");
                e.trigger("change");
                if (!!f.select) {
                    f.select([])
                }
            }
        }, treeNodeCheck: function (j, d) {
            $tree = d.parents(".lr-select-option-content");
            var e = d.parents(".lr-select");
            var c = e.find(".lr-select-placeholder");
            e.removeClass("lr-select-focus");
            var g = e[0]._lrselect.dfop;
            var f = $tree.lrtreeSet("getCheckNodesEx");
            g.currtentItems = f;
            var n = "";
            for (var h = 0, k = f.length; h < k; h++) {
                var m = f[h];
                if (n != "") {
                    n += ","
                }
                n += m.text
            }
            if (n == "") {
                c.html("==" + g.placeholder + "==");
                c.css("color", "#999")
            } else {
                c.text(n);
                c.css("color", "#000")
            }
            e.trigger("change");
            if (!!g.select) {
                g.select(g.currtentItems)
            }
        }, defaultValue: function (d) {
            var e = d[0]._lrselect.dfop;
            e.currtentItem = null;
            e._index = -1;
            var c = d.find(".lr-select-placeholder");
            c.css("color", "#999");
            c.html("==" + e.placeholder + "==");
            d.trigger("change")
        }
    };
    a.fn.lrselect = function (e) {
        var d = {
            placeholder: "请选择",
            type: "default",
            value: "id",
            text: "text",
            title: "title",
            maxHeight: 200,
            width: false,
            allowSearch: false,
            url: false,
            data: false,
            param: null,
            method: "GET",
            select: false,
            isload: false,
            isrender: false
        };
        a.extend(d, e || {});
        var c = a(this);
        if (c.length == 0) {
            return c
        }
        d.id = c.attr("id");
        if (!d.id) {
            return false
        }
        if (!!c[0]._lrselect) {
            return c
        }
        c[0]._lrselect = {dfop: d};
        a.lrselect.bindEvent(c);
        if (!!d.url) {
            b.httpAsync(d.method, d.url, d.param, function (f) {
                c[0]._lrselect.dfop.data = f || [];
                c[0]._lrselect.dfop.backdata = f || [];
                d.isload = true
            })
        } else {
            if (!!d.data) {
                d.isload = true;
                d.backdata = d.data
            } else {
                a.lrselect.htmlToData(c);
                d.isload = true;
                d.backdata = d.data
            }
        }
        a.lrselect.initRender(d, c);
        return c
    };
    a.fn.lrselectRefresh = function (e) {
        var c = a(this);
        if (c.length == 0) {
            return c
        }
        if (!c[0]._lrselect) {
            return false
        }
        var d = c[0]._lrselect.dfop;
        if (!d) {
            return false
        }
        a.extend(d, e || {});
        d.isload = false;
        d.isrender = false;
        if (!!d.url) {
            b.httpAsync(d.method, d.url, d.param, function (f) {
                c[0]._lrselect.dfop.data = f || [];
                c[0]._lrselect.dfop.backdata = f || [];
                d.isload = true
            })
        } else {
            if (!!d.data) {
                d.isload = true;
                d.backdata = d.data
            }
        }
        a.lrselect.defaultValue(c);
        if (d._setValue != null && d._setValue != undefined) {
            c.lrselectSet(d._setValue)
        }
    };
    a.fn.lrselectGet = function () {
        var c = a(this);
        if (c.length == 0) {
            return c
        }
        var d = c[0]._lrselect.dfop;
        var g = "";
        switch (d.type) {
            case"default":
                if (!!d.data[d._index]) {
                    g = d.data[d._index][d.value]
                }
                break;
            case"tree":
                if (!!d.currtentItem) {
                    g = d.currtentItem[d.value]
                }
                break;
            case"treemultiple":
                if (!!d.currtentItems) {
                    for (var e = 0, f = d.currtentItems.length; e < f; e++) {
                        if (g != "") {
                            g += ","
                        }
                        g += d.currtentItems[e][d.value]
                    }
                }
                break;
            case"gird":
                break;
            case"multiple":
                d.multipleValue = d.multipleValue || [];
                return String(d.multipleValue);
                break;
            default:
                break
        }
        return g
    };
    a.fn.lrselectSet = function (f) {
        var c = a(this);
        if (c.length == 0) {
            return c
        }
        f = f + "";
        if (f == "" || f == undefined || f == null) {
            a.lrselect.defaultValue(c);
            return c
        }
        var e = c[0]._lrselect.dfop;
        e._setValue = null;
        if (!e) {
            return c
        }

        function d(m) {
            if (m.isload == false) {
                setTimeout(function () {
                    d(m)
                }, 100)
            } else {
                if (m.isload == true) {
                    var j;
                    switch (m.type) {
                        case"default":
                            for (var n = 0, o = m.data.length; n < o; n++) {
                                if (m.data[n][m.value] == f) {
                                    m._index = n;
                                    j = m.data[n];
                                    break
                                }
                            }
                            break;
                        case"tree":
                            j = a.lrtree.findItem(m.data, m.value, f);
                            m.currtentItem = j;
                            break;
                        case"treemultiple":
                            a.lrselect.render(m);
                            c.find(".lr-select-option-content").lrtreeSet("setCheck", f.split(","));
                            return false;
                            break;
                        case"gird":
                            break;
                        case"multiple":
                            m.multipleMapValue = {};
                            m.multipleValue = [];
                            m.multipleText = [];
                            if (m.isrender) {
                                c.find('.lr-select-node-cb[src$="checkbox_1.png"]').attr("src", "/Content/images/learuntree/checkbox_0.png")
                            }
                            var k = f.split(",");
                            for (var n = 0, o = m.data.length; n < o; n++) {
                                var h = a.inArray(m.data[n][m.value], k);
                                if (h != -1) {
                                    m.multipleMapValue[n] = h;
                                    m.multipleValue.push(m.data[n][m.value]);
                                    m.multipleText.push(m.data[n][m.text]);
                                    if (m.isrender) {
                                        c.find('[data-value="' + n + '"] .lr-select-node-cb').attr("src", "/Content/images/learuntree/checkbox_1.png")
                                    }
                                    if (!!m.select) {
                                        m.select(m.data[n], true, c)
                                    }
                                }
                            }
                            j = m.multipleText;
                            break;
                        default:
                            break
                    }
                    if (!!j) {
                        if (m.type == "multiple") {
                            var g = c.find(".lr-select-placeholder");
                            if (m.multipleText.length > 0) {
                                g.css("color", "#000")
                            } else {
                                g.css("color", "#999")
                            }
                            g.html(String(m.multipleText));
                            c.trigger("change")
                        } else {
                            var g = c.find(".lr-select-placeholder");
                            g.html(j[m.text]);
                            g.css("color", "#000");
                            c.trigger("change");
                            if (!!m.select) {
                                m.select(j)
                            }
                        }
                    } else {
                        m._setValue = f
                    }
                }
            }
        }

        d(e);
        return c
    }
})(jQuery, top.learun);
(function (a, f) {
    var b = {
        bootstraper: top.$.workflowapi + "/workflow/bootstraper",
        taskinfo: top.$.workflowapi + "/workflow/taskinfo",
        processinfo: top.$.workflowapi + "/workflow/processinfo",
        create: top.$.workflowapi + "/workflow/create",
        audit: top.$.workflowapi + "/workflow/audit"
    };
    var d = function (j, i, g, h) {
        f.loading(true, h || "正在获取数据");
        f.httpAsync("GET", j, i, function (k) {
            f.loading(false);
            g(k)
        })
    };
    var e = function (j, i, g, h) {
        f.loading(true, h || "正在获取数据");
        f.httpAsync("Post", j, i, function (k) {
            f.loading(false);
            g(k)
        })
    };

    function c() {
        var g = {token: top.$.cookie("Learun_ADMS_V6.1_Token"), loginMark: top.$.cookie("Learun_ADMS_V6.1_Mark"),};
        return g
    }

    f.workflowapi = {
        bootstraper: function (h) {
            var g = {isNew: true, processId: "", schemeCode: "",};
            a.extend(g, h);
            var i = c();
            i.data = JSON.stringify({isNew: g.isNew, processId: g.processId, schemeCode: g.schemeCode});
            e(b.bootstraper, i, function (j) {
                if (j != null) {
                    if (j.status == 1) {
                        h.callback(true, j.data)
                    } else {
                        f.alert.error(j.desc);
                        h.callback(false)
                    }
                } else {
                    f.alert.error("获取流程信息失败!");
                    h.callback(false)
                }
            }, "正在获取流程信息...")
        }, create: function (h) {
            var g = {isNew: true, processId: "", schemeCode: "",};
            a.extend(g, h);
            var i = c();
            i.data = JSON.stringify({
                isNew: g.isNew,
                processId: g.processId,
                schemeCode: g.schemeCode,
                processName: g.processName,
                processLevel: g.processLevel,
                description: g.description,
                formData: h.formData
            });
            e(b.create, i, function (j) {
                if (j != null) {
                    if (j.status == 1) {
                        h.callback(true)
                    } else {
                        f.alert.error(j.desc);
                        h.callback(false)
                    }
                } else {
                    f.alert.error("创建流程失败!");
                    h.callback(false)
                }
            }, "正在创建流程实例...")
        }, taskinfo: function (h) {
            var g = {isNew: false, processId: "", taskId: "",};
            a.extend(g, h);
            var i = c();
            i.data = JSON.stringify({isNew: g.isNew, processId: g.processId, taskId: g.taskId});
            e(b.taskinfo, i, function (j) {
                if (j != null) {
                    if (j.status == 1) {
                        h.callback(true, j.data)
                    } else {
                        f.alert.error(j.desc);
                        h.callback(false)
                    }
                } else {
                    f.alert.error("获取流程信息失败!");
                    h.callback(false)
                }
            }, "正在获取流程信息...")
        }, audit: function (h) {
            var g = {verifyType: "", taskId: "",};
            a.extend(g, h);
            var i = c();
            i.data = JSON.stringify({
                taskId: g.taskId,
                verifyType: g.verifyType,
                description: g.description,
                auditorId: g.auditorId,
                auditorName: g.auditorName,
                formData: h.formData
            });
            e(b.audit, i, function (j) {
                if (j != null) {
                    if (j.status == 1) {
                        h.callback(true)
                    } else {
                        f.alert.error(j.desc);
                        h.callback(false)
                    }
                } else {
                    f.alert.error("流程审核失败!");
                    h.callback(false)
                }
            }, "正在审核流程实例...")
        }, processinfo: function (h) {
            var g = {isNew: false, processId: "", taskId: "",};
            a.extend(g, h);
            var i = c();
            i.data = JSON.stringify({isNew: false, processId: g.processId, taskId: g.taskId});
            e(b.processinfo, i, function (j) {
                if (j != null) {
                    if (j.status == 1) {
                        h.callback(true, j.data)
                    } else {
                        f.alert.error(j.desc);
                        h.callback(false)
                    }
                } else {
                    f.alert.error("获取流程信息失败!");
                    h.callback(false)
                }
            }, "正在获取流程信息...")
        },
    }
})(jQuery, top.learun);
(function (a, b) {
    a.fn.lrcontextmenu = function (e) {
        var d = {menulist: [], before: false};
        a.extend(d, e || {});
        var c = a(this);
        d.id = c.attr("id");
        if (!d.id) {
            return false
        }
        if (!!c[0]._lrcontextmenu) {
            return false
        }
        c[0]._lrcontextmenu = {dfop: d};
        c.on("contextmenu", function (n) {
            n.preventDefault();
            var g = a(this);
            var m = g[0]._lrcontextmenu.dfop;
            var r = m.id + "_contextmenu_wrap";
            var j = a("#" + r);
            if (j.length > 0) {
                if (!!m.before) {
                    m.before(n, j)
                }
                j.show()
            } else {
                j = a('<div class="lr-contextmenu-wrap" id="' + r + '" ><ul class="lr-contextmenu-ul"></ul></div>');
                var h = j.find(".lr-contextmenu-ul");
                for (var o = 0, q = m.menulist.length; o < q; o++) {
                    var p = m.menulist[o];
                    var f = a('<li data-value="' + p.id + '" ><a href="javascript:;"><span>' + p.text + "</span><a></li>");
                    f.on("click", p.click);
                    h.append(f)
                }
                a("body").append(j);
                j.show();
                if (!!m.before) {
                    m.before(n, j)
                }
            }
            var k = a(window).scrollTop() + n.clientY,
                s = (j.width() + n.clientX < a(window).width()) ? n.clientX : n.clientX - j.width(),
                t = (j.height() + n.clientY < a(window).height()) ? k : k - j.height();
            j.css({left: s, top: t})
        });
        a(document).on("click", function () {
            var g = d.id + "_contextmenu_wrap";
            var f = a("#" + g);
            f.hide()
        })
    }
})(jQuery, top.learun);
(function ($, learun) {
    var userinfo;
    var imChat;
    var isLoaded = 0;
    $.imServer = {
        init: function () {
            $.imServer.getUserInfo(function () {
            })
        }, connect: function () {
            $.ajax({
                url: userinfo.imUrl + "/hubs", type: "get", dataType: "text", success: function (data) {
                    eval(data);
                    console.log(userinfo);
                    $.connection.hub.url = userinfo.imUrl;
                    $.connection.hub.qs = {userId: userinfo.userId};
                    imChat = $.connection.ChatsHub;
                    $.imServer.registerClient();
                    $.connection.hub.start().done(function () {
                        $.imServer.afterSuccess()
                    });
                    $.connection.hub.disconnected(function () {
                        $.imServer.disconnected()
                    })
                }, error: function (XMLHttpRequest, textStatus, errorThrown) {
                    isLoaded = -1
                },
            })
        }, afterSuccess: function () {
            isLoaded = 1
        }, disconnected: function () {
        }, registerClient: function () {
            if (imChat) {
                imChat.client.revMsg = function (formUser, msg, dateTime) {
                }
            }
        }, registerServer: function () {
            $.imServer.getUserList = function (departmentId, callback) {
                console.log(isLoaded);
                if (isLoaded == 1) {
                    imChat.server.getUserList(departmentId).done(function (list) {
                        if (!!callback) {
                            callback(list)
                        }
                    })
                } else {
                    if (isLoaded == 0) {
                        setTimeout(function () {
                            $.imServer.getUserList(departmentId, callback)
                        }, 500)
                    }
                }
            }
        }, getUserInfo: function (callback) {
            userinfo = learun.clientdata.get(["userinfo"]);
            if (!!userinfo) {
                callback()
            } else {
                setTimeout(function () {
                    $.imServer.getUserInfo(callback)
                }, 100)
            }
        }
    }
})(jQuery, top.learun);
(function (a, c) {
    var d;
    var b = false;
    a.lrIM = {
        init: function () {
            a._lrIM.render()
        }, addMsgTolist: function (h, k, j, i) {
            var f = a("#learun_im_last_list");
            var e = f.find('[data-value="' + h + '"]');
            if (e.length > 0) {
            } else {
                var g = '<li data-value="' + h + '">';
                g += '<img src="' + top.$.rootUrl + "/Content/images/learunim/" + i + '">';
                g += "";
                g += '<div class="lr-im-onemsg">';
                g += '<p class="lr-im-onemsg-title">' + k + "</p>";
                g += '<p class="lr-im-onemsg-content">' + j + "</p>";
                g += "</div></li>"
            }
        }, updateMsgNum: function (e, f) {
        }
    };
    a._lrIM = {
        render: function () {
            var f = '<div class="lr-im-icon"  ><a href="javascript:;" id="lr_imicon_btn" title="企业内部通讯"><i class="fa fa-commenting"></i><span class="label label-success"></span></a></div>';
            f += '<div class="lr-im-wrap" >';
            f += '<div class="lr-im-user-list" style="display:none;" id="learun_im_list" >';
            f += '<div class="lr-im-header">企业内部通讯<div class="lr-im-close"><a id="learun_im_close" href="javascript:;">×</a></div></div>';
            f += '<div class="lr-im-search"><input type="text" placeholder="搜索：同事名称、讨论组名称"><i class="fa fa-search"></i></div>';
            f += '<div class="lr-im-body">';
            f += '<div class="lr-im-body-nav" id="learun_im_list_nav" ><ul>';
            f += '<li class="active nav_tab" data-value="last"><a title="最近回话"><i class="fa fa-comment"></i></a></li>';
            f += '<li class="nav_tab" data-value="user"><a title="联系人"><i class="fa fa-user"></i></a></li>';
            f += '<li class="nav_tab" data-value="group"><a title="讨论组"><i class="fa fa-users" style="font-size: 20px;"></i></a></li>';
            f += "</ul></div>";
            f += '<div class="lr-im-body-list" id="learun_im_body_list">';
            f += '<div id="learun_im_last_list" class="learun_im_body_ul active" ></div>';
            f += '<div id="learun_im_user_list" class="learun_im_body_user" style="display:none;" ><div class="lr-top-department" > <div id="im_department"></div> </div><div class="lr-userlist-content" id="lr_userlist_content" > <ul id="lr_userlist" class="lr-im-chatlist"></ul></div></div>';
            f += '<div id="learun_im_group_list" class="learun_im_body_ul" style="display:none;" ></div>';
            f += "</div>";
            f += "</div>";
            f += "</div>";
            f += '<div class="lr-im-window" style="display:none;" id="learun_im_window">';
            f += '<div class="lr-im-window-header"><span class="text"></span><div class="close"><a href="javascript:;">×</a></div></div>';
            f += '<div class="lr-im-window-chat">';
            f += '<div class="lr-im-window-content">';
            f += "</div></div>";
            f += '<div class="lr-im-window-tool"><a class="lr-im-window-tool-chatlogbtn "><i class="fa fa-clock-o"></i>沟通记录</a></div>';
            f += '<div class="lr-im-window-send"><textarea autofocus placeholder="按回车发送消息,shift+回车换行"></textarea></div>';
            f += "</div>";
            f += "</div>";
            a("body").append(f);
            a("#lr_imicon_btn").on("click", function () {
                var g = a("#learun_im_list");
                if (g.is(":hidden")) {
                    g.show()
                }
            });
            a("#learun_im_close").on("click", function () {
                var g = a("#learun_im_list");
                var h = a("#learun_im_window");
                g.hide();
                h.hide()
            });
            a("#learun_im_list_nav li").on("click", function () {
                var i = a(this);
                if (!i.hasClass("active")) {
                    var h = i.parent();
                    h.find(".active").removeClass("active");
                    i.addClass("active");
                    var j = "#learun_im_" + i.attr("data-value") + "_list";
                    var g = a(j);
                    a("#learun_im_body_list>div.active").removeClass("active").hide();
                    g.addClass("active").show()
                }
            });
            a("#learun_im_body_list").delegate(".lr-user-item", "click", function (h) {
                var g = a(this);
                var i = g.attr("data-value");
                var j = g.find("a").text();
                console.log(i);
                a._lrIM.openWindow(i, j)
            });
            var e = a("#learun_im_window .lr-im-window-send");
            e.delegate("textarea", "keypress", function (g) {
                var h = g.keyCode || g.which || g.charCode;
                var j = g.shiftKey || g.metaKey;
                if (j && h == "13") {
                } else {
                    if (h == "13" && b) {
                        var i = a(this).val();
                        if (i) {
                            a._lrIM.addRightMsg(d.realName, c.getDate("yyyy-MM-dd hh:mm"), a._lrIM.getUserImg(), i)
                        }
                        a("#learun_im_window .lr-im-window-send").html('<textarea autofocus placeholder="按回车发送消息,shift+回车换行"></textarea>');
                        setTimeout(function () {
                            a("#learun_im_window .lr-im-window-send>textarea").focus()
                        }, 100);
                        g.preventDefault();
                        return false
                    }
                }
            });
            a("#im_department").lrselect({
                type: "tree",
                maxHeight: 343,
                allowSearch: true,
                url: top.$.rootUrl + "/LR_OrganizationModule/Department/GetTree",
                param: {companyId: "", parentId: ""},
                placeholder: "请选择部门",
                select: function (h) {
                    var g = a("#lr_userlist");
                    g.html("");
                    a.imServer.getUserList(h.value, function (i) {
                        a.each(i, function (j, k) {
                            g.append(a._lrIM.getUserHtml(k))
                        })
                    })
                }
            });
            d = c.clientdata.get(["userinfo"]);
            a("#im_department").lrselectSet(d.departmentId);
            a("#lr_userlist_content").mCustomScrollbar({theme: "minimal-dark"});
            a("#learun_im_window .lr-im-window-chat").mCustomScrollbar({theme: "minimal-dark"})
        }, initData: function () {
        }, getUserHtml: function (f) {
            if (f.F_UserId != d.userId) {
                var e = "";
                if (c.isExistImg(top.$.rootUrl + f.F_HeadIcon)) {
                    headimg = top.$.rootUrl + f.F_HeadIcon
                } else {
                    if (f.F_Gender != 0) {
                        headimg = top.$.rootUrl + "/Content/images/head/on-boy.jpg"
                    } else {
                        headimg = top.$.rootUrl + "/Content/images/head/on-girl.jpg"
                    }
                }
                e = '<li class="lr-user-item" data-value="' + f.F_UserId + '"  ><img class="headimg" src="' + headimg + '"><a>' + f.F_RealName + "</a></li>";
                return e
            }
        }, getUserImg: function () {
            var e = "";
            if (c.isExistImg(top.$.rootUrl + d.headIcon)) {
                e = top.$.rootUrl + d.headIcon
            } else {
                if (d.gender != 0) {
                    e = top.$.rootUrl + "/Content/images/head/on-boy.jpg"
                } else {
                    e = top.$.rootUrl + "/Content/images/head/on-girl.jpg"
                }
            }
            return e
        }, openWindow: function (f, g) {
            var e = a("#learun_im_window");
            e.attr("data-value", f);
            e.find(".lr-im-window-header>.text").text(g);
            a("#learun_im_window .lr-im-window-content").html("");
            e.show();
            b = true
        }, addRightMsg: function (i, e, g, h) {
            var f = '<div class="right"><div class="author-name">';
            f += '<small class="chat-date">' + e + "</small>";
            f += '<small class="chat-text">' + i + "</small>";
            f += '<img src="' + g + '" />';
            f += "</div>";
            f += '<div class="chat-message"><em></em>' + h + "</div></div>";
            a("#learun_im_window .lr-im-window-content").append(f);
            a("#learun_im_window .lr-im-window-chat").mCustomScrollbar("scrollTo", "bottom")
        }
    }
})(jQuery, top.learun);
var loaddfimg;
(function (a, b) {
    var c = {
        init: function () {
            if (a("body").hasClass("IE") || a("body").hasClass("InternetExplorer")) {
                a("#lr_loadbg").append('<img src="' + top.$.rootUrl + '/Content/images/ie-loader.gif" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;margin: auto;vertical-align: middle;">');
                Pace.stop();
                a.imServer.init()
            } else {
                Pace.on("done", function () {
                    a("#lr_loadbg").fadeOut();
                    Pace.options.target = "#learunpacenone";
                    a.imServer.init()
                })
            }
            toastr.options = {
                closeButton: true,
                debug: false,
                newestOnTop: true,
                progressBar: false,
                positionClass: "toast-bottom-right",
                preventDuplicates: false,
                onclick: null,
                showDuration: "300",
                hideDuration: "1000",
                timeOut: "3000",
                extendedTimeOut: "1000",
                showEasing: "swing",
                hideEasing: "linear",
                showMethod: "fadeIn",
                hideMethod: "fadeOut"
            };
            b.frameTab.open({
                F_ModuleId: "0",
                F_Icon: "fa fa-desktop",
                F_FullName: "首页模板",
                F_UrlAddress: "/Home/AdminDesktopTemp"
            }, true);
            b.clientdata.init(function () {
                c.userInit();
                bootstrap(a, b);
                if (a("body").hasClass("IE") || a("body").hasClass("InternetExplorer")) {
                    a("#lr_loadbg").fadeOut()
                }
            });
            c.loadbarInit();
            c.fullScreenInit();
            c.uitheme()
        }, userInit: function () {
            var f = b.clientdata.get(["userinfo"]);
            var e;
            if (f.gender != 0) {
                e = top.$.rootUrl + "/Content/images/head/on-boy.jpg"
            } else {
                e = top.$.rootUrl + "/Content/images/head/on-girl.jpg"
            }
            loaddfimg = function () {
                document.getElementById("userhead").src = e
            };
            var d = '<div class="lr-frame-personCenter"><a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">';
            d += '<img id="userhead" src="' + top.$.rootUrl + f.headIcon + '" alt="用户头像" onerror="loaddfimg()" >';
            d += "<span>" + f.realName + "</span>";
            d += "</a>";
            d += '<ul class="dropdown-menu pull-right">';
            d += '<li><a href="javascript:void(0);" id="lr_userinfo_btn"><i class="fa fa-user"></i>个人信息</a></li>';
            d += '<li><a href="javascript:void(0);" id="lr_schedule_btn"><i class="fa fa-calendar"></i>我的日程</a></li>';
            d += '<li class="divider"></li>';
            if (f.isSystem) {
                d += '<li><a href="javascript:void(0);" id="lr_clearredis_btn"><i class="fa fa-refresh"></i>清空缓存</a></li>';
                d += '<li class="divider"></li>'
            }
            d += '<li><a href="javascript:void(0);" id="lr_loginout_btn"><i class="fa fa-power-off"></i>安全退出</a></li>';
            d += "</ul></div>";
            a("body").append(d);
            a("#lr_loginout_btn").on("click", c.loginout);
            a("#lr_userinfo_btn").on("click", c.openUserCenter);
            a("#lr_clearredis_btn").on("click", c.clearredis)
        }, loginout: function () {
            b.layerConfirm("注：您确定要安全退出本次登录吗？", function (d) {
                if (d) {
                    b.loading(true, "退出系统中...");
                    b.httpAsyncPost(a.rootUrl + "/Login/OutLogin", {}, function (e) {
                        window.location.href = a.rootUrl + "/Login/Index"
                    })
                }
            })
        }, clearredis: function () {
            b.layerConfirm("注：您确定要清空全部后台缓存数据吗？", function (d) {
                if (d) {
                    b.loading(true, "清理缓存数据中...");
                    b.httpAsyncPost(a.rootUrl + "/Home/ClearRedis", {}, function (e) {
                        window.location.href = a.rootUrl + "/Login/Index"
                    })
                }
            })
        }, openUserCenter: function () {
            b.frameTab.open({
                F_ModuleId: "1",
                F_Icon: "fa fa-user",
                F_FullName: "个人中心",
                F_UrlAddress: "/UserCenter/Index"
            })
        }, fullScreenInit: function () {
            var d = '<div class="lr_frame_fullscreen"><a href="javascript:void(0);" id="lr_fullscreen_btn" title="全屏"><i class="fa fa-arrows-alt"></i></a></div>';
            a("body").append(d);
            a("#lr_fullscreen_btn").on("click", function () {
                if (!a(this).attr("fullscreen")) {
                    a(this).attr("fullscreen", "true");
                    c.requestFullScreen()
                } else {
                    a(this).removeAttr("fullscreen");
                    c.exitFullscreen()
                }
            })
        }, requestFullScreen: function () {
            var d = document.documentElement;
            if (d.requestFullscreen) {
                d.requestFullscreen()
            } else {
                if (d.mozRequestFullScreen) {
                    d.mozRequestFullScreen()
                } else {
                    if (d.webkitRequestFullScreen) {
                        d.webkitRequestFullScreen()
                    }
                }
            }
        }, exitFullscreen: function () {
            var d = document;
            if (d.exitFullscreen) {
                d.exitFullscreen()
            } else {
                if (d.mozCancelFullScreen) {
                    d.mozCancelFullScreen()
                } else {
                    if (d.webkitCancelFullScreen) {
                        d.webkitCancelFullScreen()
                    }
                }
            }
        }, loadbarInit: function () {
            var d = '<div class="lr-loading-bar" id="lr_loading_bar" >';
            d += '<div class="lr-loading-bar-bg"></div>';
            d += '<div class="lr-loading-bar-message" id="lr_loading_bar_message"></div>';
            d += "</div>";
            a("body").append(d)
        }, uitheme: function () {
            var g = top.$.cookie("Learn_ADMS_V6.1_UItheme") || "1";
            var e = a('<div class="lr-theme-setting"></div>');
            var d = a('<button class="btn btn-default"><i class="fa fa-spin fa-gear"></i></button>');
            var f = '<div class="panel-heading">界面风格</div>';
            f += '<div class="panel-body">';
            f += '<div><label><input type="radio" name="ui_theme" value="1" ' + (g == "1" ? "checked" : "") + ">经典版</label></div>";
            f += '<div><label><input type="radio" name="ui_theme" value="2" ' + (g == "2" ? "checked" : "") + ">风尚版</label></div>";
            f += '<div><label><input type="radio" name="ui_theme" value="3" ' + (g == "3" ? "checked" : "") + ">炫动版</label></div>";
            f += '<div><label><input type="radio" name="ui_theme" value="4" ' + (g == "4" ? "checked" : "") + ">飞扬版</label></div>";
            f += "</div>";
            e.append(d);
            e.append(f);
            a("body").append(e);
            d.on("click", function () {
                var h = a(this).parent();
                if (h.hasClass("opened")) {
                    h.removeClass("opened")
                } else {
                    h.addClass("opened")
                }
            });
            e.find("input").click(function () {
                var h = a(this).val();
                top.$.cookie("Learn_ADMS_V6.1_UItheme", h, {path: "/"});
                window.location.href = a.rootUrl + "/Home/Index"
            })
        },
    };
    a(function () {
        //c.init()
    })
})(window.jQuery, top.learun);